Accord Software, Inc.

tutorial11/main.c




/*
 * Accord Software, Inc.
 *
 * Tutorial 11
 *
 * Send array of structures and receive struct 
 * directly and by reference.
 */
#include "s_array.h"

/* create array of structs */

static struct coord data[COUNT] = {
	{ 1,  1,  1, "one"},
	{ 2,  2,  2, "two"},
	{ 3,  3,  3, "three"},
	{ 4,  4,  4, "four"},
	{ 5,  5,  5, "five"},
	{ 6,  6,  6, "six"},
	{ 7,  7,  7, "seven"},
	{ 8,  8,  8, "eight"},
	{ 9,  9,  9, "nine"},
	{10, 10, 10, "ten"}
};

main(argc, argv)
	int argc;
	char *argv[];
{
	struct coord *rp;
	struct coord r;

	rp = sp_array(data);
	printf("%s %d  %d %d ", 
			argv[0], rp->x, rp->y, rp->z);
	if (rp->token)
		printf("%s", rp->token);
	printf("\n");

	r = s_array(data);
	printf("%s %d  %d %d ", argv[0], r.x, r.y, r.z);
	if (r.token)
		printf("%s", r.token);
	printf("\n");
	exit(0);
}

[ Home | Tutorials | s_array.c | s_array.h ]
E-Mail:webmaster@accord.com
[P-032] Updated March 14, 1996
Copyright © 1993-1996 Accord Software, Inc. All rights reserved.